// TelnetLogger.h: interface for the CTelnetLogger class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_TELNETLOGGER_H__4539FD5C_300B_4BFD_BC32_45CA7C06B49A__INCLUDED_)
#define AFX_TELNETLOGGER_H__4539FD5C_300B_4BFD_BC32_45CA7C06B49A__INCLUDED_

#include "TelnetLoggerEvents.h"

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

typedef enum enumLogDirection
{
	DIR_UNSPECIFIED,
	DIR_RECEIVE,
	DIR_SEND,
} LogDirection;

typedef enum enumLogType
{
	LOG_CHAR,
	LOG_COMMAND,
	LOG_OPTION,
} LogType;

typedef struct tagLogPoint
{
	LogDirection direction;
	LogType type;
	int charIndex;
} LogPoint;


class CTelnetLogger  
{
protected:
	CCriticalSection m_cs;

	CArray<char, char> m_receiveChars;
	CArray<char, char> m_sendChars;
	CArray<LogPoint, const LogPoint&> m_logPoints;
	
	LogType m_curType;
	int m_nextReceiveCharIndex;
	int m_nextSendCharIndex;

public:
	void Clear();
	void ReceiveChar(const char c);
	void SendChar(const char c);
	void SendChars(const char* buf, int bufSize);

	//void AddLogPoint(LogDirection direction, LogType type);
	int AddSlot();
	void AddLogPoint(LogDirection direction, LogType type, int charCount, int slot = -1);

	CString GetAsHtml();

public:
	CTelnetLogger();
	virtual ~CTelnetLogger();

};


#endif // !defined(AFX_TELNETLOGGER_H__4539FD5C_300B_4BFD_BC32_45CA7C06B49A__INCLUDED_)
